<?php
/**
* 
*/
class LoginModel extends MY_Model
{
	
	function __construct()
	{
		parent::__construct();
		$this->table = 'nmp_admin';
	}


	/* 用户登录
	 * $arr			账户密码数组
	*/
	public function user_login($arr = array())
	{
		if (!empty($arr)) 
		{
			$username = trim($arr['username']);
			$password = md5($arr['password']);

			$row = $this->getRow(array('name'=>$username, 'password'=>$password));

			//更新登录时间
			$this->db->update($this->table,array('last_time' => time()),array('id' => $row['id']));

			$data['admin_id'] = $row['id'];
			return $data;
		}
		else
		{
			return false;
		}
	}


	
}




?>